<?php 

namespace Home\Controller;
use Think\Controller;

class JfzfController extends Controller{
	public function jfzf(){
			
		$username=cookie('username');
		if($username){
			$model=M('pointcard');
			$data=$model->where(['sum_num'=>['GT',0]])->select();
			$this->assign('data',$data);
			$this->display();
		}else{
			redirect(U('Login/login'));
		}



	}

	public function demo(){
		$phone='15974118307';
		 $header[] = 'Accept:application/json';
		  $header[] = 'Content-Type:application/json';
		$url="http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=$phone";
		$res=$this->curl($url,$header);
		  $res = trim(explode('=',$res)[1]);
	    $res = iconv('gbk','utf-8', $res);
	    $res = str_replace("'",'"', $res);
	    $res = preg_replace('/(\w+):/is', '"$1":', $res);
	     $res = json_decode($res, true);
		print_r($res);
	}
	public function curl($url,$header){
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
		// curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
		
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
		
		
		curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
		curl_setopt($curl, CURLOPT_URL, $url);
		
		$r = curl_exec($curl); 
		curl_close($curl);
		return $r;
	}

	

}











 ?>